package org.garbagecan.springstudy.beansfactory;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
	public static void main(String[] args) {
		//test1();
		test2();
	}
	
	public static void test1() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"/org/garbagecan/springstudy/beansfactory/spring-propertyplaceholder1.xml");
		MyBean myBean = (MyBean) ctx.getBean("myBean");
		System.out.println(myBean);
	}
	
	public static void test2() {
		System.setProperty("name", "Mandy");
		System.setProperty("prop1", "111");
		System.setProperty("prop2", "222");
		System.setProperty("prop3", "333");
		System.setProperty("prop4", "10000");
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"/org/garbagecan/springstudy/beansfactory/spring-propertyplaceholder2.xml");
		MyBean myBean = (MyBean) ctx.getBean("myBean");
		System.out.println(myBean);
	}
}
